<template>
    <div style="margin: 10px">
        <h2>四则运算</h2>


    </div>
</template>

<script>
    export default {
        name: 'app',
        data() {
            return {
                value: 2,
                limit: 100,
            }
        },
        computed: {
        },
        methods: {
            alertIsPrime() {
                alert(this.isPrime(this.value) ? "是质数" : "不是质数");
            },
            isPrime(number) {
                let sqrt = Math.sqrt(number);
                for (let i = 2; i < sqrt; i++) {
                    if (number % i === 0) {
                        return false;
                    }
                }
                return true;
            },
            listPrimeWithinLimit(limit) {
                let list = [];
                for (let i = 2; i <= limit; i++) {
                    if (this.isPrime(i)) {
                        list.push(i)
                    }
                }
                return list;
            }
        },
        mounted() {

        }
    }
</script>

<style>

</style>
